package business;

import java.util.ArrayList;
import model.HolidayDTO;
import dao.DAOException;
import dao.DAOFactory;
import dao.HolidayDAO;

public class HolidayManager {
	private HolidayDAO holidayDAO;
	
	public HolidayManager()
	{
		holidayDAO = DAOFactory.loadInstance().getHolidayDAO();
	}
	
	public void insertHoliday(HolidayDTO holiday) 
	{
		try
		{
			holidayDAO.insertHoliday(holiday);
		}
		catch(DAOException e)
		{
			e.printStackTrace();
		}
	}
	public void deleteHoliday(HolidayDTO holiday)
	{
		try
		{
			holidayDAO.deleteHoliday(holiday);
		}
		catch(DAOException e)
		{
			e.printStackTrace();
		}
	}
	@SuppressWarnings("finally")
	public ArrayList<HolidayDTO> findAllHoliday()
	{
		ArrayList<HolidayDTO> currentList = new ArrayList<HolidayDTO>();
		try
		{
			currentList = holidayDAO.findAllHoliday();
		}
		catch(DAOException e)
		{
			e.printStackTrace();
		}
		finally
		{
			return currentList;
		}
	}
	@SuppressWarnings("finally")
	public HolidayDTO findHoliday(int holidayID) 
	{
		HolidayDTO currentfacility = new HolidayDTO();
		try
		{
			currentfacility = holidayDAO.findHoliday(holidayID);
		}
		catch(DAOException e)
		{
			e.printStackTrace();
		}
		finally
		{
			return currentfacility;
		}
	}
}
